
package com.ukao.steward.pesenter.logistics;

import com.ukao.steward.base.BasePresenter;
import com.ukao.steward.bean.EnterFactoryBean;
import com.ukao.steward.consts.Constant;
import com.ukao.steward.consts.SaveParams;
import com.ukao.steward.retrofit.ApiCallback;
import com.ukao.steward.view.logistics.LeverFactoryView;

import java.util.HashMap;

import rx.Observable;

/**
 * Created by ukaodev on 2017/6/28.
 */

public class LeverFactoryPesenter extends BasePresenter<LeverFactoryView> {


    public LeverFactoryPesenter(LeverFactoryView view) {
        attachView(view);
    }

    /**
     *出厂批号 未送店
     */
    public void enterFactoryNotTake(  int pageNum ,int pageSize,int  type) {

        HashMap mHashMap = new HashMap<String, String>();
        mHashMap.put("pageNum",pageNum+"");
        mHashMap.put("pageSize",pageSize+"");
        mHashMap.put("accessToken", SaveParams.getToken());
        Observable observable = null;
        switch (type) {
            case 1:
                observable=apiStores.sendingStore(Constant.createParameter(mHashMap));
                break;
            case 2:
                observable=apiStores.arriveStore(Constant.createParameter(mHashMap));
                break;
            case 3:/* 出厂订单 未送店*/
                observable=apiStores.sendingOrderlist(Constant.createParameter(mHashMap));
                break;
            case 4:/*出厂订单  到达门店*/
                observable=apiStores.factoryOutOrdid(Constant.createParameter(mHashMap));


                break;
        }

        addSubscription(observable,
                new ApiCallback<EnterFactoryBean>() {
                    @Override
                    public void onSuccess(EnterFactoryBean model) {

                        if (model.getHttpCode() == 200) {

                            mvpView.enterFactorySucceed(model.getData());
                        }else{

                              mvpView.showError(model.getMsg());
                        }

                    }

                    @Override
                    public void onFinish() {

                    mvpView.loadfinish();

                    }
                });
    }











}
